<?php

/**
 * XHTML_Br, xhtml_lib
 * 
 * This file contains the source code for the XHTML_Br class.
 * @author Fernando Jimenez Mocobono <fjmcool@gmail.com>
 * @version 0.1
 * @package xhtml_lib
 */

include_once "XHTML_Core_Attributes.php";
include_once "XHTML__Special_Pre.php";

/**
 * The XHTML_Br class is a handler for the br xhtml-strict tag as a part
 * of a xhtml-strict php-handler implementation.
 */
class XHTML_Br implements XHTML_Core_Attributes, XHTML__Special_Pre {
    
    // xhtml attributes to implement XHTML_Core_Attributes

    /**
     * Unique identifier for the id xhtml-core-attribute.
     * 
     * @var string
     */
    protected $id;
    
    /**
     * Class_rule or style_rule for the class xhtml-core-attribute.
     *
     * @var string
     */
    protected $class;
    
    /**
     * Inline style definition for the style xhtml-core-attribute.
     *
     * @var string
     */
    protected $style;
    
    /**
     * Title text for the title xhtml-core-attribute.
     *
     * @var string
     */
    protected $title;
    

    // Method implementation for the XHTML_Core_Attributes interface.
    
    /**
     * Sets the unique identifier for this element.
     *
     * @param string $id
     */
    function setId($id)
    {
        $this->id = $id;
    }
    
    /**
     * Gets the unique identifier that has been set for this element.
     * 
     * @return string
     */
    function getId()
    {
        return $this->getId();
    }
    
    /**
     * Sets the class_rule or style_rule for this element.
     * i.e. The CSS pseudo-class name.
     *
     * @param string $className
     */
    function setClass($class)
    {
        $this->class = $class;
    }
    
    /**
     * Gets the class_rule or style rule that has been set for this element.
     * 
     * @return string;
     */
    function getClass()
    {
        return $this->class;
    }
    
    /**
     * Sets the inline style definition for this element.
     *
     * @param string $style
     */
    function setStyle($style)
    {
        $this->style = $style;
    }
    
    /**
     * Gets the inline style definition that has been set for this element.
     *
     * @return string
     */
    function getStyle()
    {
        return $this->style;
    }
    
    /**
     * Sets the title text for this element.
     *
     * @param string $title
     */
    function setTitle($title)
    {
        $this->title = $title;
    }
    
    /**
     * Gets the title text that has been set for this element.
     *
     * @return string
     */
    function getTitle()
    {
        return $this->getTitle();
    }
    
    // Overriding the toString method for a proper implementation.
    
    /**
    * Returns the string representation for echoing the class atributes.
    *
    * @return string
    */
    function toString()
    {
        $auxString = "<br ";
        
        if (isset($this->id)) {
            $auxString = $auxString."id=\"".$this->id."\" ";
        }
        
        if (isset($this->class)) {
            $auxString = $auxString."class=\"".$this->class."\" ";
        }
        
        if (isset($this->style)) {
            $auxString = $auxString."style=\"".$this->style."\" ";
        }
        
        if (isset($this->title)) {
            $auxString = $auxString."title=\"".$this->title."\" ";
        }
        
        $auxString = $auxString."/>\n";
        
        return $auxString;
    }
    
}

?>